#include <stdio.h>

int i = 0;

void movedisc(unsigned n,char fromneedle,char toneedle,char unsingneedle)
{
    if(n>0)
    {
        movedisc(n-1,fromneedle,unsingneedle,toneedle);
        ++i;
        switch(fromneedle)
        {
            case 'a':switch(toneedle)
            {
                case 'b':printf("\t[%d]:\t%2d----------->%2d\n",i,n,n);
                break;
                case 'c':printf("\t[%d]:\t%2d----------->%2d\n",i,n,n);
                break;
            }
            break;
            case 'b':switch(toneedle)
            {
                case 'a':printf("\t[%d]:\t%2d<---------------%2d\n",i,n,n);
                break;
                case 'c':printf("\t[%d]:\t\t%2d<-------------%2d\n",i,n,n);
                break;
            }
            break;
            case 'c':switch(toneedle)
            {
                case 'a':printf("\t[%d]:\t%2d<-----------------%2d\n",i,n,n);
                break;
                case 'b':printf("\t[%d]:\t\t%2d<------------------%2d\n",i,n,n);
                break;
            }
            break;
        }
        movedisc(n-1,unsingneedle,toneedle,fromneedle);
    }
}

int main()
{
    unsigned n;
    printf("Please enter the number of discs:");
    scanf("%d",&n);
    printf("\tneedle:\ta\tb\tc\n");
    movedisc(n,'a','c','b');
    printf("\t Total:%d\n,i");
}